<html>

<head>
    <meta charset="utf-8">
    <title>会员卡</title>
    {php include $this->template($this->cur_tpl.'/_common_meta');}
    <link rel="stylesheet" type="text/css" href="{RES}mobile/{php echo $this->cur_tpl}/css/main.css?v=4" media="all">
    <link rel="stylesheet" type="text/css" href="{RES}mobile/{php echo $this->cur_tpl}/css/dialog.css" media="all">
    <script type="text/javascript" src="{RES}mobile/{php echo $this->cur_tpl}/js/jquery_min.js"></script>
    <script type="text/javascript" src="{RES}mobile/{php echo $this->cur_tpl}/js/main.js"></script>
    <script type="text/javascript" src="{RES}mobile/{php echo $this->cur_tpl}/js/dialog_min.js"></script>
    <script type="text/javascript" src="{RES}mobile/{php echo $this->cur_tpl}/js/mymain.js"></script>
</head>
<script type="text/javascript">
          var payAmount="{$payAmount}";
         // if(parseInt(payAmount)>0){
        if(parseFloat(payAmount)>0){
        	
        	callpay();
          }
            	
           
            //调用微信JS api 支付
            function jsApiCall()
            {
                WeixinJSBridge.invoke(
                    'getBrandWCPayRequest',
                    <?php echo $jsApiParameters; ?>,
                    function(res){
                        WeixinJSBridge.log(res.err_msg);
                       // alert(res.err_code+res.err_desc+res.err_msg);
                        var dostring = res.err_msg;
        				var temparr = dostring.split(':');
        				if(temparr.length == 2){
        				  // Tmsg(temparr[1]);
        				   if(temparr[1] == 'ok'){
        				     // window.location.reload(); 
        				     var url="{php echo $this->createMobileUrl('index')}";
        				     window.location.href=url;
        				   }
        				}else{
        				   Tmsg(res.err_msg);
        				}
                       
                    }
                );
            }
            function callpay()
            {
                if (typeof WeixinJSBridge == "undefined"){
                    if( document.addEventListener ){
                        document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
                    }else if (document.attachEvent){
                        document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                        document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
                    }
                }else{
                    jsApiCall();
                }
            }
 </script>


<body onselectstart="return true;" ondragstart="return false;" class="bc-bg">

    <div id="js_redpacket_list">
        <form id="form2" name="form2" action="{php echo $this->createMobileUrl('consume')}" method="post" class="bc-form-inner">
            <div class="bc-form-inner-input">消费金额: <input name="money" type="number" placeholder="请输入消费金额" maxlength="10" /></div>
             <div class="bc-form-inner-input pay_pass" style="display:none;">消费密码: <input name="pay_pass" type="password" placeholder="请输入消费密码" maxlength="6" /></div>
            <div class="bc-form-inner-select">
                支付方式 :<select name="paytype" class="select" onChange="SelectCode(this);">'+
                    <option value="1">在线支付 </option>
                    <option value="2">余额支付 </option>
                </select>
            </div>
       
    </div>
    <div class="bc-money-info b-b">
        <i class="red">卡</i>
        {$level['levelname']}享受{php echo $level['ratio']/10}折
    </div>
    <div class="list_ul">
        <li>
            <a href=""><label class="label">优惠券<span>&nbsp;</span></label></a>
        </li>
        <li>
            <a href=""><label class="label">积分 <div class="bc-info-switch">可用<f>0</f>积分抵扣￥<f>0</f>
                    </div> <input class="mui-switch mui-switch-animbg" type="checkbox" checked="checked"></label></a>
        </li>
        <li>
            <a href=""><label class="label">余额 <div class="bc-info-switch">可用￥<f>0</f>积分</div> <input class="mui-switch mui-switch-animbg"
                        type="checkbox" checked="checked"></label></a>
        </li>
    </div>
    <div class="bc-money-info" style="margin-top:10px">
        <i>赠</i>
        消费送积分：满<span>1.00</span>元送<span class="imp">1</span>积分
    </div>
    <div class="bc-nav-bottom">
        <div class="bc-nav-bottom-btn sure-pay" onclick="checksumit();">确认买单</div>
        <div class="bc-nav-bottom-info member_money">实付 <span>￥0.00</span></div>
        
    </div>
     </form>
    <script type="text/javascript">
        document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
            WeixinJSBridge.call('hideToolbar');
        });
    </script>
     <script type="text/javascript">
    function SelectCode(obj){
    	
    	 if($(obj).val()=='2'){
       	  $(".pay_pass").show();
         }else{
       	  $(".pay_pass").hide();
         }
    	
    }
         
  var ratio=parseInt("{$level['ratio']}")/100;
 
    $("input[name=money]").change(function(){
    	   $(".member_money").html( (parseFloat($(this).val())*ratio).toFixed(2) );
    	});
     
     function checksumit(){
    	
    	 $("#form2").submit();
     }
     </script>

</body>

</html>